#include "groupmemberitem.h"
#include "ui_groupmemberitem.h"

GroupMemberItem::GroupMemberItem(struct st_gMemberData gmdata,QWidget *parent) :
    QWidget(parent),
    ui(new Ui::GroupMemberItem)
{
    ui->setupUi(this);

    QString hname = QString("%1.png").arg(gmdata.mid);
    QString headUrl = QString("%1/%2").arg(PATH_IMG).arg(hname);
    int borderWidth = 8; // 边框的宽度
    cv::Scalar borderColor(0, 0, 0, 255);
    ui->lab_head->setPixmap(RoundBorderPixmap(downLoadFromUrl(headUrl),borderWidth,borderColor));
    ui->lab_nick->setText(gmdata.nick);

}

GroupMemberItem::~GroupMemberItem()
{
    delete ui;
}

bool GroupMemberItem::getMe() const
{
    return me;
}

void GroupMemberItem::setMe(bool newMe)
{
    me = newMe;
    // 自己标志
    if(me)
        ui->lab_identify->setText("我");
}

bool GroupMemberItem::getBoss() const
{
    return boss;
}

void GroupMemberItem::setBoss(bool newBoss)
{
    boss = newBoss;
    // 群主标志
    if(boss)
        ui->lab_identify->setPixmap(QPixmap(":/prefix2/software/gboss.png"));
}
